﻿package com.firewolf.iteratorAndComponent.iterator.self.iterators;

import java.util.ArrayList;

import com.firewolf.iteratorAndComponent.iterator.common.MyMenuItem;

/**
 * 午餐迭代器
 * @author Administrator
 *
 */
public class LunchMenuIterator implements MyIterator{
	private ArrayList<MyMenuItem> menuItems;
	private int index = 0;
	public LunchMenuIterator(ArrayList<MyMenuItem> menuItems) {
		this.menuItems = menuItems;
	}
	@Override
	public boolean hasNext() {
		if(index >= menuItems.size())
			return false;
		return true;
	}

	@Override
	public Object next() {
		MyMenuItem menuItem = menuItems.get(index);
		index = index+1;
		return menuItem;
	}
}
